package com.lanou.service;

import com.lanou.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
@Autowired
private AuthenticationManager authenticationManager;
@Override
public boolean login(String username,String password)
{
Authentication authenticate =
authenticationManager.authenticate(new
        UsernamePasswordAuthenticationToken(username, password));
return authenticate.isAuthenticated();
}
}